package com.vecspace.web.servlet.model;

/**用于统一封装Controller的返回值
 * 
 * @version 1.0
 * @author wanghua
 * @reviewer  
 * @createTime 2021年9月29日 下午4:12:57
 */
public class ServletResultWraper {
	private Object data;
	
	public ServletResultWraper() {
		
	}
	
	public ServletResultWraper(Object data) {
		this.data = data;
	}
		
	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	/**1正常 -1异常*/
	private int resultCode = 1;
	
	private String errMsg;
	private String warnMsg;
	private String logMsg;
	
	public boolean getHasError() {
		return resultCode == -1;
	}
	
	public void setError(boolean isError) {
		resultCode = isError ? -1 : 0;
	}
	
	/**设置错误信息，同时设置resultCode=-1
	 * 
	 * @param errMsg 
	 * @author wanghua
	 * @reviewer  
	 * @createTime 2021年9月7日 下午3:24:53
	 */
	public void setError(String errMsg) {
		resultCode = -1;
		this.errMsg = errMsg;
	}
	
	public int getResultCode() {
		return resultCode;
	}

	public void setResultCode(int resultCode) {
		this.resultCode = resultCode;
	}

	public String getErrMsg() {
		return errMsg;
	}
	public void setErrMsg(String errMsg) {
		this.errMsg = errMsg;
	}
	public String getWarnMsg() {
		return warnMsg;
	}
	public void setWarnMsg(String warnMsg) {
		this.warnMsg = warnMsg;
	}
	public String getLogMsg() {
		return logMsg;
	}
	public void setLogMsg(String logMsg) {
		this.logMsg = logMsg;
	}
}
